package com.zkzx.company.api.client.company;

import com.zkzx.common.company.command.CompanyCommand;
import com.zkzx.common.company.model.CompanyDriverVO;
import com.zkzx.common.company.model.CompanyListVO;
import com.zkzx.common.company.model.CompanyVO;
import com.zkzx.common.driver.vo.DriverStatisticsVO;
import com.zkzx.common.exception.BaseException;
import com.zkzx.common.truck.command.TruckCommand;
import com.zkzx.common.truck.model.CompanyTruckVO;
import com.zkzx.common.truck.model.TruckListVO;
import com.zkzx.common.truck.vo.TruckStatisticsVO;
import com.zkzx.common.vo.PageResult;
import com.zkzx.common.vo.StatusVO;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @author young Email:yanghui@zkraising.com
 * @description
 * @company 北京中科智兴物联科技有限公司 @版权所有
 * @since 2021年04月29日 11时44分
 */
@FeignClient(value = "ZKZX-COMPANY-BASE") // 本地调用 先以接口地址为准进行调用
//@FeignClient(name = "ZKZX-COMPANY-BASE",url = "http://localhost:28080")
public interface CompanyClient {

    // 企业基本信息
    @PostMapping("/ZKZX-COMPANY-BASE/companies")
    StatusVO add(@RequestBody CompanyCommand command, @RequestHeader("userId") Integer userId) throws BaseException;

    @PutMapping("/ZKZX-COMPANY-BASE/companies/{id}")
    void update(@RequestBody CompanyCommand command, @PathVariable("id") Integer id, @RequestHeader("userId") Integer userId);

    @GetMapping("/ZKZX-COMPANY-BASE/companies/{id}")
    CompanyVO getById(@PathVariable("id") Integer id);

    @GetMapping("/ZKZX-COMPANY-BASE/companies")
    PageResult<CompanyListVO> find(@ApiParam(value = "查询参数") @RequestParam("filterParam") String companyFilterParam,
                                   @ApiParam(value = "分页查询参数")  @RequestParam("params") String params);



    // 企业关联司机信息
    @PostMapping("/ZKZX-COMPANY-BASE/company_drivers")
    void add(@RequestBody CompanyDriverVO companyDriverVO);

    @GetMapping("/ZKZX-COMPANY-BASE/company_drivers")
    PageResult<CompanyDriverVO> findCompanyDriver(@RequestParam("filterParam") String filterParamJson, @RequestParam("params") String paramsJson) ;

    @GetMapping("/ZKZX-COMPANY-BASE/company_drivers/company_driver")
    List<CompanyDriverVO> getByDriverIdAndCompanyId(@RequestParam("driver_id")Integer driverId, @RequestParam("company_id")Integer companyId);

    @PutMapping("/ZKZX-COMPANY-BASE/company_drivers")
    void update(@RequestBody @Valid CompanyDriverVO companyDriverVO);

    @GetMapping("/ZKZX-COMPANY-BASE/company_drivers/statistics")
    DriverStatisticsVO getDriverStatistics(@RequestParam("company_id")Integer companyId);



    // 企业关联车辆信息
    @GetMapping("/ZKZX-COMPANY-BASE/company_trucks")
    PageResult<TruckListVO> findTruckList(@RequestParam("filterParam") String filterParamJson, @RequestParam("params") String paramsJson, @RequestHeader("companyId") Integer companyId);

    @PutMapping("/ZKZX-COMPANY-BASE/company_trucks")
    void  updateTruck(@RequestBody @Valid TruckCommand command, @RequestHeader("companyId") Integer companyId);

    @GetMapping("/ZKZX-COMPANY-BASE/company_trucks/list")
    List<CompanyTruckVO> getByTruckIdCompanyId(@RequestParam("truck_id")Integer truckId, @RequestParam("company_id")Integer companyId);

    @GetMapping("/ZKZX-COMPANY-BASE/company_trucks/statistics")
    TruckStatisticsVO getTruckStatistics(@RequestParam("company_id")Integer companyId);


    //短信发送
    @GetMapping("/ZKZX-COMPANY-BASE/sms")
    Boolean sendSms(@RequestParam("phone_numbers") String phoneNumbers, @RequestParam("template_code") String templateCode, @RequestParam("template_param") String templateParam);


}
